using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Sio.Mdm.Server
{
    /// <summary>
    /// Interface for custom interceptors before call is made to the server
    /// </summary>
    public interface IInvokeInterceptor
    {   
        /// <summary>
        /// Called before function is invoked with server
        /// </summary>
        /// <param name="method">Methods that will be invoked</param>
        /// <param name="args">Arguments passed to function</param>
        /// <param name="result">
        /// You can provide custom return value for the method, But be sure it's of 
        /// the same type as method is declared or .NET engine will crash.
        /// </param>
        /// <returns>Return false to prevent invocation</returns>
        bool BeforeInvoke(MethodInfo method, object[] args, string proxyName, out object result);
        /// <summary>
        /// Called after successfull invocation was made to the server
        /// </summary>
        /// <param name="method">Invoked method information</param>
        /// <param name="args">Argument passed to function</param>
        /// <param name="result">return value of invocation</param>
        void AfterInvoke(MethodInfo method, object[] args, object result, InvocationError error);
    }
}
